﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Mbs.Modularity;
using Mbs.Collections;
using Mbs.Windows.Elements;
using Mbs.Reflection;

namespace Mbs.Windows.Attributes
{
    [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
    public sealed class ViewAttribute : AddInItemAttribute
    {
        public ViewAttribute()
        {
            base.Properties.Set("Type", ElementIDType.Smartpart);
        }

        public string Workspace
        {
            get { return base.Properties.Get<string>("Workspace"); }
            set { base.Properties.Set("Workspace", value); }
        }

        public Type ViewType
        {
            get { return ServiceLocator.Current.Get<IClassLoader>().LoadType( base.Properties.Get<string>("SmartPartType")); }
            set { base.Properties.Set("SmartPartType", value.FullName + "," + value.Assembly.GetName().FullName); }
        }
    }

    [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
    public class WindowsAddInItemAttribute : SampleAddInItemAttribute
    {
        public string ToolTip
        {
            get { return base.Properties.Get<string>("ToolTip"); }
            set { base.Properties.Set("ToolTip", value); }
        }
    }

    [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
    public class MenuStripAttribute : AddInItemAttribute
    {
        public MenuStripAttribute()
        {
            base.Properties.Set("Type", ElementIDType.MenuStrip);
        }
    }

    [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
    public class ToolStripAttribute : AddInItemAttribute
    {
        public ToolStripAttribute()
        {
            base.Properties.Set("Type", ElementIDType.ToolStrip);
        }
    }

    [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
    public class ContextMenuStripAttribute : AddInItemAttribute
    {
        public ContextMenuStripAttribute()
        {
            base.Properties.Set("Type", ElementIDType.ContextMenuStrip);
        }
    }

    [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
    public class StatusStripAttribute : AddInItemAttribute
    {
        public StatusStripAttribute()
        {
            base.Properties.Set("Type", ElementIDType.StatusStrip);
        }
    }

    [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
    public class ToolStripMenuItemAttribute : WindowsAddInItemAttribute
    {
        public ToolStripMenuItemAttribute()
        {
            base.Properties.Set("Type", ElementIDType.ToolStrip_MenuItem);
        }
    }

    [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
    public class ToolStripLanguageMenuItemAttribute : WindowsAddInItemAttribute
    {
        public ToolStripLanguageMenuItemAttribute()
        {
            base.Properties.Set("Type", ElementIDType.ToolStrip_LanguageMenuItem);
        }
    }

    [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
    public class ToolStripButtonAttribute : WindowsAddInItemAttribute
    {
        public ToolStripButtonAttribute()
        {
            base.Properties.Set("Type", ElementIDType.ToolStrip_Button);
        }
    }

    [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
    public class ToolStripComboBoxAttribute : WindowsAddInItemAttribute
    {
        public ToolStripComboBoxAttribute()
        {
            base.Properties.Set("Type", ElementIDType.ToolStrip_ComboBox);
        }
    }

    [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
    public class ToolStripDropDownButtonAttribute : WindowsAddInItemAttribute
    {
        public ToolStripDropDownButtonAttribute()
        {
            base.Properties.Set("Type", ElementIDType.ToolStrip_DropDown_Button);
        }
    }

    [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
    public class ToolStripLabelAttribute : WindowsAddInItemAttribute
    {
        public ToolStripLabelAttribute()
        {
            base.Properties.Set("Type", ElementIDType.ToolStrip_Label);
        }
    }

    [AttributeUsage(AttributeTargets.All, AllowMultiple = true)]
    public class ToolStripSeparatorAttribute : WindowsAddInItemAttribute
    {
        public ToolStripSeparatorAttribute()
        {
            base.Properties.Set("Type", ElementIDType.ToolStrip_Separator);
        }
    }

    [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
    public class ToolStripSplitButtonAttribute : WindowsAddInItemAttribute
    {
        public ToolStripSplitButtonAttribute()
        {
            base.Properties.Set("Type", ElementIDType.ToolStrip_Split_Button);
        }
    }

    [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
    public class ToolStripStatusLabelAttribute : WindowsAddInItemAttribute
    {
        public ToolStripStatusLabelAttribute()
        {
            base.Properties.Set("Type", ElementIDType.ToolStrip_Status_Label);
        }
    }

    [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
    public class ToolStripTextBoxAttribute : WindowsAddInItemAttribute
    {
        public ToolStripTextBoxAttribute()
        {
            base.Properties.Set("Type", ElementIDType.ToolStrip_TextBox);
        }
    }
}
